package cn.iocoder.yudao.module.api.pay.bill.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 账单模式枚举
 *
 * @author 山野羡民
 */
@Getter
@AllArgsConstructor
public enum BillModeEnum implements EnumValuable {

    UNKNOWN(-1, "未知"),
    EXPEND(0, "支出"),
    INCOME(1, "收入"),
    ;

    @EnumValue
    private final Integer value;
    private final String name;

    public static BillModeEnum valueOf(int value) {
        return Stream.of(BillModeEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(UNKNOWN);
    }


}
